<template>
  <a-card 
    class="tasks-card" 
    title="待办事项" 
    :header-style="{ paddingBottom: '0' }"
    :body-style="{ paddingTop: '26px' }">
    <template #extra>
      <a-link @click="fetchData"><template #icon><icon-refresh /></template>刷新</a-link>
    </template>
    <div>
      <p v-for="a in list" :key="a.taskId" class="row">
        <a-link :href="a.redirectUrl">
          <!-- <i :class="'type'+a.taskTypeId">{{a.taskTypeName}}</i> -->
          <a-typography>
            <i :class="'type'+a.taskTypeId">{{a.taskTypeName}}</i>
            <a-typography-text>
              {{a.taskTitle}}
            </a-typography-text>
          </a-typography>
        </a-link>
      </p>
    </div>
  </a-card>
</template>

<script lang="ts" setup>
// import Vue from 'vue'
import { ref,watch } from 'vue';
import { useRoute, useRouter, RouteRecordRaw } from 'vue-router';
import { getUncompletedTasks } from '@/api/dashboard';

const router = useRouter();
const list = ref([] as Array<any>);
async function fetchData(){
  list.value = await getUncompletedTasks();
}
fetchData();

const GoPage = (url: any) => {
  router.push({ name: url, });
};
</script>

<style lang="less" scoped>
:deep(.arco-card-header-title) {
  line-height: inherit;
}
.tasks-card {
  .row {
    line-height: 2em;
    margin: 0;
    a {
      color: #333;
    }
    i {
      float: left;
      font-style: normal;
      width: 5em;
      text-align: center;
      border: 1px solid blue;
      color: blue;
      border-radius: 14px;
      margin-right: 0.5em;
    }
    .type222001,.type222002 {
      color: green;
      border-color: green;
    }
    .type222003 {
      color: skyblue;
      border-color: skyblue;
    }
    .type222009,.type222010,.type222011,.type222012 {
      color: darkblue;
      border-color: darkblue;
    }
    .type222013 {
      color: red;
      border-color: red;
    }
    .type {
      color: blue;
      border-color: blue;
    }
  }
}

</style>
